import RPi.GPIO as GPIO
import time

#红外距离传感器
class InfraredSensor(object):
    def __init__(self,sensor_left=12,sensor_right=16):
        self.sensor_left = sensor_left
        self.sensor_right = sensor_right
        
    #初始化
    def init(self):
        GPIO.setup(self.sensor_right,GPIO.IN)
        GPIO.setup(self.sensor_left,GPIO.IN)
        
    #启动红外
    def start(self):        
        pass
    
    #左红外传感器
    def getLeft(self):
        return GPIO.input(self.sensor_left)

    #右红外传感器
    def getRight(self):
        return GPIO.input(self.sensor_right)